﻿#ifndef DATAWIDGET_H
#define DATAWIDGET_H

#include <QWidget>
#include "include/global.h"
#include "include/plot.h"
QT_BEGIN_NAMESPACE
class QGridLayout;
class QLabel;
QT_END_NAMESPACE




class DataWidget : public QWidget
{
    Q_OBJECT
public:
    DataWidget(QWidget *parent = 0);
    ~DataWidget();
	//void MainWindow::updateDataWidgetWaveUI(int stationNo, /*DataWindows*/quint8 sensorType, long sensorNo, long id, float data)
   // inline void updateDatawidgetWave(/*DataWindows*/quint8 dataWidget, long id, float data)
	inline void updateDatawidgetWave(int stationNo,int datatype,int sensorNo, float data)
    {
        dataWindow[sensorNo]->setDataByIndex(stationNo, data);//站+传感器编号data
    }
	void setTotalStations(int n){ //通知每个窗口，现在总的采集站数目变化
		stationsNums = n;
		for(int i = 0; i < N_WINDOWS; ++i){
			dataWindow[i]->setCurrentStationNums(n);
		}
	}
	void setCurrentStation(int k){//设置当前显示哪个采集站数据
		currentStation = k;
		for(int i = 0; i < N_WINDOWS; ++i){
			dataWindow[i]->setCurrentStation(k);//告知每个波形窗口，需要显示哪个采集站的数据
		}
	}
private:
    Plot* dataWindow[N_WINDOWS];
    QGridLayout* gridLayout;
	int stationsNums;
	int currentStation;
private Q_SLOTS:
public Q_SLOTS:
     void updateDatawidgetUI(long);//update datawidget UI
Q_SIGNALS:
};
#endif // MAINWINDOW_H
